From: Florian Müllner Date: Fri, 24 Apr 2026 22:19:36 +0000 (+0200) Subject: shell/app: Be extra careful when applying GPU environment X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~10^2^2~22 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e017af9ee09e7127a70b6ae6fe9da3aa2587aff0;p=gnome-shell.git shell/app: Be extra careful when applying GPU environment We get the environment from SwitcherooControl as an array of key-value pairs. When applying it, we loop over the array in pairs, assuming that every key has a value. While this is the expected format, it does not hurt to be defensive against possible bugs in the service, so explicitly check that both key and value are non-NULL before applying them. Spotted by papagai. Part-of: --- diff --git a/src/shell-app.c b/src/shell-app.c index ed7ecfffe..acb996c0b 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -1338,7 +1338,7 @@ apply_discrete_gpu_env (GAppLaunchContext *context, continue; env_s = g_variant_get_strv (env, NULL); - for (j = 0; env_s[j] != NULL; j = j + 2) + for (j = 0; env_s[j] != NULL && env_s[j+1] != NULL; j = j + 2) g_app_launch_context_setenv (context, env_s[j], env_s[j+1]); return; }